package com.lifeng.system.controller;

import com.lifeng.common.result.Result;
import com.lifeng.system.pojo.Stall;
import com.lifeng.system.service.StallService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author lifeng
 * @create 2022-11-24 16:00
 */
@RestController
@RequestMapping("/admin/system/stall")
@CrossOrigin
public class StallController {

    @Autowired
    private StallService stallService;

    /**
     条件查询带分页
     */
    @GetMapping("/{page}/{limit}")
    public Result findPageQueryStall(@PathVariable Long page,
                                     @PathVariable Long limit,
                                     Stall stall){

        //创建page对象
        Page<Stall> pageParam = new Page<>(page,limit);
        //调用service方法
        IPage<Stall> pageModel = stallService.selectPage(pageParam,stall);

        return Result.ok(pageModel);

    }

    @GetMapping("/{token}")
    public Result test(@PathVariable String token){
//        String token = request.getHeader("token");
        System.out.println("..................");
        System.out.println(token);
        return Result.ok();
    }

}
